home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
ms_dos
/
txf
/
src
/
txfmain.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-08
|
2KB
|
111 lines
/***************
*
* g:\exe\txf\src\txfmain.c
*/
#define MAIN 1
#include "txf.h"
void setdefault()
{
if (right > 0) right --;
if (maxc > 0) maxc --;
if (cent > 0) {
if (left < 0) left = (maxc - cent) / 2;
if (right < 0) right = (maxc + cent) / 2;
}
if (left < 0) left = 0;
if ((right < 0) || (right > maxc)) right = maxc - 4;
if (viewmode > 2)
fprintf(stderr,
"\x1b[31mWarning:This is debug mode for nobody. (mode=%d)\x1b[0m\n",
viewmode);
if (tfile[0][0] == NUL) gettmpfile();
mktfilename();
if (kl == NULL) {
kl = calloc(1, 1);
}
if (kf == NULL) {
kf = calloc(1, 1);
}
if (kq == NULL) {
kq = calloc(1, 1);
}
}
void init(char *name)
{
char *path;
#if !TXFL
path = ((strlen(name) > 35) ? jstrrchr(name, '\\') : name);
fprintf(stderr,"%s Ver1.43d Copyright (C) 1992-1993 T.Nakatani\n", path);
#else
path = ((strlen(name) > 26) ? jstrrchr(name,'\\') : name);
fprintf(stderr,"%s Ver1.43d(compact) Copyright (C) 1992-1993 T.Nakatani\n", path);
#endif
init_allswitch();
basedir=name;
read_def(name);
kl = NULL;
kf = NULL;
kq = NULL;
#if !TXFL
log_idstr[0] = NUL;
log_resp[0] = NUL;
log_handle[0] = NUL;
log_fname[0] = NUL;
log_pname[0] = NUL;
log_pname[8] = NUL;
#endif
}
void txf()
{
tmpinfile =- 1;
if (removeeofflg) removeeof();
/* if (e1flg==1) e1driver(e1old,e1new); */
#if !TXFL
if (exflg && (useoldex == 0)) exchangedriver();
if (exflg && useoldex) old_exchangedriver();
#else
if (exflg) exchangedriver();
#endif
/* if (e2flg == 1) e1driver(e2old,e2new); */
if (format) {
if (base == 0) setleft0(); /* 自動検索 */
if (base > 0) setleft();
txform();
}
input_to_output();
}
void endoftxf()
{
remove(tfile[0]);
remove(tfile[1]);
if (*outputfile == NUL) {
fprintf(stderr, "\n");
}
}
int main(int argc, char **argv)
{
init(argv[0]);
swchk(argc - 1, &argv[1]);
setdefault();
while (wcchk()) txf();
endoftxf();
return (0);
}